<!DOCTYPE html>
<html    xmlns:th="http://www.thymeleaf.org">

<head th:replace="comm/common :: header(~{::title},~{},~{})">
    <title>资源分配</title>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight" style="padding:0px;">
        <div class="row">
            <div style="width: 100%">
                <div class="ibox">
                    <div class="ibox-content">
                        <form id="allotRes"  class="wizard-big layui-form  xtree-main">
                            <input type="hidden" name="roleId" th:value="${role.id}"  autocomplete="off" class="layui-input">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">角色名称：</label>
                                <div class="col-sm-8">
                                    <input id="roleName" th:value="${role.roleName}" disabled="disabled" minlength="2" type="text" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">请选择需要分配的资源</label>
                                <div class="input-group">
                                    <div id="resIds" class="xtree_contianer"></div>
                                </div>
                            </div>
                            <div class="form-group" style="text-align: center">
                                <div class="col-sm-4 col-sm-offset-3">
                                    <button id="addRoleSubmit" class="btn btn-block btn-primary">保存</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div th:replace="comm/common :: bottom"></div>
    <script th:src="@{/admin/role/allot_res.js}"></script>
    <script>
        layui.use(['form'], function () {
            var f = layui.form;
            var xtree2 = new layuiXtree({
                elem: 'resIds',                  //(必填) 放置xtree的容器，样式参照 .xtree_contianer
                form: f,                    //(必填) layui 的 from
                isopen: true,
//                ckall: true,
                color: {       //三种图标颜色，独立配色，更改几个都可以
                    open: "#EE9A00"        //节点图标打开的颜色
                    , close: "#EEC591"     //节点图标关闭的颜色
                    , end: "#828282"       //末级节点图标的颜色
                },
                data: '/sso/admin/res/treeList?roleId='+[[${role.id}]] //(必填) 数据接口，需要返回以上结构的json字符串
            });
        });
    </script>

</body>

</html>
